
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>数值跳动</title>
<link rel="shortcut icon" href="#"/>
<script type="text/javascript" src="countUp.scroll.js"></script>
</head>

<body>

<h1 id="count_part1"></h1>

<div style="width:100%; height:1000px; background-color:#ddd;"></div>

<h1 id="count_part2"></h1>

<div style="width:100%; height:1000px; background-color:#ddd;"></div>

<script type="text/javascript">
const c1 = new countSc('count_part1', 10000, {
  duration: 10,        //持续时间
  startVal: 2000,      //开始数值
  decimalPlaces: 2,    //小数位数
  useEasing: true,     //是否启用惯性
  useGrouping: true,   //是否启用数值分割(true = 1,000, false = 1000)
  separator: ',',      //启用数值分割时的分割符号
  decimal: '.',        //小数点符号
  prefix: 'pre-',      //前缀
  suffix: 'm<sup>2</sup>',     //后缀
});

const c2 = new countSc('count_part2', 200, {
  startVal: 12,
  duration: 2,
  per: 0.2,
  reset: true,
});
</script>

</body>
</html>